JavaScript Compression Alternatives to /packer/

Posted 2008-03-03 in JavaScript by Johann.

!! Squeeze !!

Photo by capsicina. Some rights reserved.

Squeezing the last bits out of your JavaScript files? Then you probably know /packer/. Maybe you even use it with YUI to automatically compress multiple JavaScripts into one file.

Recently, I discovered new alternatives to /packer/ and decided to compare them.

JavaScript compressors

The two new JavaScript crunchers I test are

  • JSIntegration, a Java-based JavaScript packer with a Java Swing frontend. I used the JSA-20071021.jar file. My settings were: “Syntax compression” on, “text compression” on, “Compatible(IE5,NS3)” on, “auto confuse” off. The header comment was removed.
  • JavaScript Utility V2 by Patrick J. O'Neil. I used the ISO-8859-1/UTF-8 setting.

Test files

The files I compressed were

  1. The JavaScript for johannburkard.de. 73716 B uncompressed, 43170 B after YUI.
  2. jQuery 1.2.3. 96763 B uncompressed, 53807 B after YUI.

I started with YUI compressed versions.

Results

johannburkard.de JavaScript

  1. 23223 B (31 %) – JavaScript Utility
  2. 25711 B (34 %) – JSA
  3. 27988 B (38 %) – /packer/

jQuery 1.2.3

  1. 25877 B (27 %) – JavaScript Utility
  2. 28646 B (30 %) – JSA
  3. 29606 B (31 %) – /packer/

Decompression times

While packed JavaScript files make your pages load faster, the browser still has to decompress the file. I didn’t benchmark all packers but the previous version of JavaScript Utility was about twice as slow as /packer/. After a recent update, JavaScript Utility is now about as fast as /packer/ (some informal performance numbers, OpenOffice document).

Edit: Neil Roberts suggested that I try ShrinkSafe instead of YUI. Here are the results:

johannburkard.de JavaScript

24689 B (33 %) – ShrinkSafe, then JavaScript Utility.

jQuery 1.2.3

27469 B (28 %) – ShrinkSafe, then JavaScript Utility.

3 comments

#1 2008-03-09 by Neil Roberts

Would be nice to see you try ShrinkSafe

#2 2008-03-11 by Johann

Done :-)

#3 2008-10-14 by felipe.lv

I think I remember reading somewhere (probably on a YUI documentation page) that you could get the best results using the YUI compressor and then gzip compression... It seems that the files served from Google's AJAX Libraries API are served this way.

Subscribe

RSS 2.0, Atom or subscribe by Email.

Top Posts

  1. DynaCloud - a dynamic JavaScript tag/keyword cloud with jQuery
  2. 6 fast jQuery Tips: More basic Snippets
  3. xslt.js version 3.2 released
  4. xslt.js version 3.0 released XML XSLT now with jQuery plugin
  5. Forum Scanners - prevent forum abuse
  6. Automate JavaScript compression with YUI Compressor and /packer/

Navigation